<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="../css/index.css" />
		<script src="../js/vue.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/vant.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/ajax.js" type="text/javascript" charset="utf-8"></script>
		<script src="html5plus://ready"></script>
		<title></title>
		<style type="text/css">
			body {
				background-color: gainsboro;
			}
			
			#one {
				background-color: red;
				height: 50px;
			}
			
			.van-nav-bar__title {
				color: white;
				font-size: 15px;
				padding-top: 5px;
			}
			
			.van-nav-bar .van-icon {
				color: white;
				padding-top: 10px;
			}
			
			.van-nav-bar__text {
				color: white;
				padding-top: 10px;
			}
			
			.van-address-list {
				height: 100%;
				padding-bottom: 10px;
				box-sizing: border-box;
			}
			
			.van-button--small {
				margin-left: -30px;
			}
			
			p {
				font-size: 16px;
			}
			#dl{
			padding-left: 50px;
			padding-right: 50px;
			margin-bottom: 20px;
			margin-top: 30px;
		}
		</style>
	</head>

	<body>
		<div id="app">
			<van-row>
				<van-nav-bar title="手机验证" left-text="返回"  left-arrow id="one" @click-left="back"></van-nav-bar>
				
			</van-row>

			<van-row id="two">
				<van-cell-group>
					<van-field v-model="phone" label="手机号" placeholder="请输入手机号" ></van-field>

					<van-field v-model="sms" center clearable label="短信验证码" placeholder="请输入短信验证码">
					<van-button slot="button" size="small" type="danger" @click="yzm">发送验证码</van-button>
					</van-field>
				</van-cell-group>	

			</van-row>
			
			<van-col span="24" id="dl">
				 	<van-button size="large" square type="danger" @click="up" >下一步</van-button>
			</van-col>
		</div>
		<script type="text/javascript">
			
			var app = new Vue({
				el: "#app",
				data: {
					chosenAddressId: "",
					password: "",
					list: [],
					sms: "",
					aa: "",
					phone: ""
				},
				methods:{
					back:function(){
						plus.webview.open("sgin.html");
					},
					yzm:function(){
						ajax({
							url:"http://dsapi.ysd3g.com/api/SendForgotPasswordPhoneCode",
							dataType:"JSONP",
							data:{
								phone: app.phone
							},	
							success:function(res){
								console.log(res);
								if(res.Error){
									app.$toast.fail(res.Msg);
									
								}
								else{
									console.log(JSON.stringify(res))
									app.$toast.success("验证码为："+res.Code);
								}
							}
							
						});
					},
					up:function(){
						
						ajax({
							url:"http://dsapi.ysd3g.com/api/ValidatePhone",
							dataType:"JSONP",
							data:{
								phone: app.phone,
								phoneCode:app.sms
							},	
							success:function(res){
								console.log(res)
								if(res.Error){
									app.$toast.fail(res.Msg);
								}
								else{
									app.$toast.success("登陆成功");
									plus.webview.open("wj-uppwd.html");									
									app.sms="";
								}
							}
							
						});
					}
				}

			});
		</script>
	</body>

</html>